import {Dimensions,Platform,StatusBar,PixelRatio} from  'react-native';
import DeviceInfo from 'react-native-device-info'

const {width, height} = Dimensions.get('window');
const  OS = Platform.OS;
const ios = (OS == 'ios');
const android = (OS == 'android');

const screenH = Dimensions.get('window').height-(ios ? 0:StatusBar.currentHeight);

// const deviceHeight = Dimensions.get('window').height;  
// const STATUS_BAR_HEIGHT = StatusBar.currentHeight; //即图中黄色部分
// const height = deviceHeight  - STATUS_BAR_HEIGHT;

global.sREM=width/375;

global.gREM=function(num){
    return num*sREM;
};

global.gTime = {};
//类似 console.time
global.gLog=function(str){
    global.gTime[str] = new Date();
}

global.gLogEnd =function(str){
    console.log(str+ (new this.Date()-global.gTime[str]))
}

//当前选中的tab
global.SelectedTabNum = '';

global.hasLoaded = false;

global.Constant = {
    apiDomain: '',
    webDomain: '',
    imgDomain: 'https://img.shuaiche.com',
    imApiAddr: '',
    imWsAddr: '',
    release: true,//是否是release环境
    sessionId: '',
    reviewState:'1',
    
    screen_width:width,
    screen_height: screenH,
    statusBarHeight: 0,
    navigationBarHeight: 0,
    bottomHeight: 0,
    onePixelRatio:1/PixelRatio.get(),
    ios:ios,
    android:android,
    isIPhoneX: 0,
    apiType: 2,

    registrationID: '',

    // 未读的求购信息数量，做一个缓存
    noViewSeekingCount: 0,
    
    userInfo: {
        phone: '',
        face: '',
        roleName: '',
        perms: '',
        userId: '',
        imToken: '',
        imUserId: '',
        fullname: '',
        merchantId: '',
        merchantName: '',
        merchantAbbreviation: '',
        merchantLogoPic: '',
        imTokenExpireTimeSeconds: '',
        memberClass: '',
        isFranchisee: '',//是否加盟商 0：否，1：是
        buyerId:0,//买手id
        isExternalCarEntryUser: 0, // 是否是外部录车人员
    },
    companyInfo:{
        
    }
}


global.isLoadMain = false//是否加载主页mainpage
